﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using VaccineHost.Model;
using VaccineHost.Services;

namespace VaccineHost.Controllers
{
    /// <summary>
    /// 预约接种记录api控制器
    /// </summary>
    [Route("api/v1/vaccination")]
    [Authorize]
    [ApiController]
    public class VaccinationController : ControllerBase
    {
        private IVaccinationService _vaccinationService;

        public VaccinationController(IVaccinationService vaccinationService)
        {
            this._vaccinationService = vaccinationService;
        }

        /// <summary>
        /// 更新疫苗接种状态
        /// </summary>
        /// <param name="updateInput"></param>
        /// <returns></returns>
        [Route("info")]
        [HttpPut]
        public async Task<OpResult> Update(UpdateVaccinationInfoInput updateInput)
        {
            return await _vaccinationService.Update(updateInput);
        }

        [Route("all")]
        [HttpGet]
        public async Task<object> GetAll()
        {
            return await this._vaccinationService.GetVaccinations();
        }
    }
}
